package com.zwz.alLayer;

import com.zwz.resp.basic.EnterpriseReport;

import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;


//O(n)
public class ShareholderUtil {
    public static BigDecimal findMaxShareRatio(List<EnterpriseReport.ShareholderInfo> shareholders) {
        if (shareholders == null || shareholders.isEmpty()) {
            return null;
        }
        return shareholders.stream()
                .map(EnterpriseReport.ShareholderInfo::getShareRatio)
                .filter(Objects::nonNull)
                .max(BigDecimal::compareTo)
                .orElse(null);
    }
}